﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApplication1.logic
{
    class Functions
    {
        private static Random random = new Random((int)DateTime.Now.Ticks);

        /// <summary>
        /// Generate the random string.
        /// </summary>
        /// <param name="size">The size of the random generated string.</param>
        /// <returns>The random generated string.</returns>
        public static string RandomString(int size)
        {
            var builder = new StringBuilder();
            for (int i = 0; i < size; i++)
            {
                char ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
                builder.Append(ch);
            }

            return builder.ToString();
        }
    }
}
